import router from '@/router/index';
import { getStore } from '@/utils/store';
let history = '';
router.beforeEach((to, from, next) => {
	if (to.meta?.isAuth) {
		history = to;
		if (getStore('user')) {
			next()
		} else {
			next({ path: '/login?redirect=' + history?.path || '' })
		}
	} else {
		next()
	}
})

router.afterEach((e) => {
	document.title = `${e.name}${window.cdns.doc_title_suffix}`;
});